﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using ZQNB.Entity.Dics;

namespace ZQNB.BaseLib.Dics
{
    /// <summary>
    /// 开发用
    /// 用来生成默认的数据
    /// </summary>
    public class DicInitData
    {
        //--------------helpers-----------------
        private static readonly IList<DicType> dicTypes = new List<DicType>();
        private static readonly IList<DicItem> dicItems = new List<DicItem>();

        static DicInitData()
        {
            #region 年级

            //年级
            dicTypes.Add(CreateDicType("Grade", true, true, "年级"));
            //年级项
            //DicItems.Add(CreateDicItem("Grade", "GO001", "0～2 岁", 0, false, "", "", ""));
            //DicItems.Add(CreateDicItem("Grade", "GO002", "2～6 岁", 0, false, "", "", ""));
            dicItems.Add(CreateDicItem("Grade", "GO003", "小学一年级", 0, true, "", "", ""));
            dicItems.Add(CreateDicItem("Grade", "GO004", "小学二年级", 0, true, "", "", ""));
            dicItems.Add(CreateDicItem("Grade", "GO005", "小学三年级", 0, true, "", "", ""));
            dicItems.Add(CreateDicItem("Grade", "GO006", "小学四年级", 0, true, "", "", ""));
            dicItems.Add(CreateDicItem("Grade", "GO007", "小学五年级", 0, true, "", "", ""));
            dicItems.Add(CreateDicItem("Grade", "GO008", "小学六年级", 0, false, "", "", ""));
            dicItems.Add(CreateDicItem("Grade", "GO009", "初中一年级", 0, false, "", "", ""));
            dicItems.Add(CreateDicItem("Grade", "GO010", "初中二年级", 0, false, "", "", ""));
            dicItems.Add(CreateDicItem("Grade", "GO011", "初中三年级", 0, false, "", "", ""));
            dicItems.Add(CreateDicItem("Grade", "GO012", "高中一年级", 0, false, "", "", ""));
            dicItems.Add(CreateDicItem("Grade", "GO013", "高中二年级", 0, false, "", "", ""));
            dicItems.Add(CreateDicItem("Grade", "GO014", "高中三年级", 0, false, "", "", ""));
            //DicItems.Add(CreateDicItem("Grade", "GO015", "大专一年级", 0, false, "", "", ""));
            //DicItems.Add(CreateDicItem("Grade", "GO016", "大专二年级", 0, false, "", "", ""));
            //DicItems.Add(CreateDicItem("Grade", "GO017", "大专三年级", 0, false, "", "", ""));
            //DicItems.Add(CreateDicItem("Grade", "GO018", "大本一年级", 0, false, "", "", ""));
            //DicItems.Add(CreateDicItem("Grade", "GO019", "大本二年级", 0, false, "", "", ""));
            //DicItems.Add(CreateDicItem("Grade", "GO020", "大本三年级", 0, false, "", "", ""));
            //DicItems.Add(CreateDicItem("Grade", "GO021", "大本四年级", 0, false, "", "", ""));
            //DicItems.Add(CreateDicItem("Grade", "GO022", "硕士一年级", 0, false, "", "", ""));
            //DicItems.Add(CreateDicItem("Grade", "GO023", "硕士二年级", 0, false, "", "", ""));
            //DicItems.Add(CreateDicItem("Grade", "GO024", "硕士三年级", 0, false, "", "", ""));
            //DicItems.Add(CreateDicItem("Grade", "GO025", "博士一年级", 0, false, "", "", ""));
            //DicItems.Add(CreateDicItem("Grade", "GO026", "博士二年级", 0, false, "", "", ""));
            //DicItems.Add(CreateDicItem("Grade", "GO027", "博士三年级", 0, false, "", "", ""));
            //DicItems.Add(CreateDicItem("Grade", "GO028", "职高一年级", 0, false, "", "", ""));
            //DicItems.Add(CreateDicItem("Grade", "GO029", "职高二年级", 0, false, "", "", ""));
            //DicItems.Add(CreateDicItem("Grade", "GO030", "职高三年级", 0, false, "", "", ""));
            //DicItems.Add(CreateDicItem("Grade", "GO031", "高职一年级", 0, false, "", "", ""));
            //DicItems.Add(CreateDicItem("Grade", "GO032", "高职二年级", 0, false, "", "", ""));
            //DicItems.Add(CreateDicItem("Grade", "GO033", "高职三年级", 0, false, "", "", ""));
            //DicItems.Add(CreateDicItem("Grade", "GO034", "高职四年级", 0, false, "", "", ""));
            //DicItems.Add(CreateDicItem("Grade", "GO035", "中专一年级", 0, false, "", "", ""));
            //DicItems.Add(CreateDicItem("Grade", "GO036", "中专二年级", 0, false, "", "", ""));
            //DicItems.Add(CreateDicItem("Grade", "GO037", "中专三年级", 0, false, "", "", ""));
            //DicItems.Add(CreateDicItem("Grade", "GO038", "技工学校", 0, false, "", "", ""));
            //DicItems.Add(CreateDicItem("Grade", "GO039", "继续教育", 0, false, "", "", ""));
            //DicItems.Add(CreateDicItem("Grade", "GO040", "职业培训", 0, false, "", "", ""));


            #endregion

            #region 学科

            //学科
            dicTypes.Add(CreateDicType("Subject", true, true, "学科"));
            //学科项
            dicItems.Add(CreateDicItem("Subject", "GS001", "语文", 0, true, "", "", ""));
            dicItems.Add(CreateDicItem("Subject", "GS002", "数学", 1, true, "", "", ""));
            dicItems.Add(CreateDicItem("Subject", "GS003", "物理", 2, true, "", "", ""));
            dicItems.Add(CreateDicItem("Subject", "GS004", "化学", 3, true, "", "", ""));
            dicItems.Add(CreateDicItem("Subject", "GS005", "政治", 4, true, "", "", ""));
            dicItems.Add(CreateDicItem("Subject", "GS006", "历史", 5, true, "", "", ""));
            dicItems.Add(CreateDicItem("Subject", "GS007", "地理", 6, true, "", "", ""));
            dicItems.Add(CreateDicItem("Subject", "GS008", "生物", 7, true, "", "", ""));
            dicItems.Add(CreateDicItem("Subject", "GS009", "英语", 8, true, "", "", ""));
            dicItems.Add(CreateDicItem("Subject", "GS010", "日语", 9, true, "", "", ""));
            dicItems.Add(CreateDicItem("Subject", "GS011", "俄语", 10, true, "", "", ""));
            dicItems.Add(CreateDicItem("Subject", "GS012", "自然", 11, true, "", "", ""));
            dicItems.Add(CreateDicItem("Subject", "GS013", "音乐", 12, true, "", "", ""));
            dicItems.Add(CreateDicItem("Subject", "GS014", "体育", 13, true, "", "", ""));
            dicItems.Add(CreateDicItem("Subject", "GS015", "美术", 14, true, "", "", ""));
            dicItems.Add(CreateDicItem("Subject", "GS016", "劳技", 15, true, "", "", ""));
            dicItems.Add(CreateDicItem("Subject", "GS017", "思想品德", 16, true, "", "", ""));
            dicItems.Add(CreateDicItem("Subject", "GS018", "信息技术", 17, true, "", "", ""));
            dicItems.Add(CreateDicItem("Subject", "GS019", "社会", 18, true, "", "", ""));
            dicItems.Add(CreateDicItem("Subject", "GS020", "职业技术", 19, true, "", "", ""));
            dicItems.Add(CreateDicItem("Subject", "GS021", "综合实践活动", 20, true, "", "", ""));
            dicItems.Add(CreateDicItem("Subject", "GS022", "研究性学习", 21, true, "", "", ""));
            dicItems.Add(CreateDicItem("Subject", "GS023", "社区服务与社会实践", 22, true, "", "", ""));

            #endregion

            #region 角色

            //角色
            dicTypes.Add(CreateDicType("Role", true, true, "角色"));
            //角色项 匿名用户     登录用户    系统管理员
            dicItems.Add(CreateDicItem("Role", "anonymous", "匿名用户", 0, true, "", "", ""));
            dicItems.Add(CreateDicItem("Role", "member", "登录用户", 1, true, "", "", ""));
            dicItems.Add(CreateDicItem("Role", "admin", "系统管理员", 2, true, "", "", ""));

            #endregion

            #region 组织类型

            //组织类别（机构（1），小学（2），初中（2），高中（2），完中（2），班级（3），其他定义（4））
            //组织类型
            dicTypes.Add(CreateDicType("OrgType", false, true, "组织类型"));
            //组织类型项
            dicItems.Add(CreateDicItem("OrgType", "LogicOrg", "机构", 0, true, "1", "", ""));
            dicItems.Add(CreateDicItem("OrgType", "Primary", "小学", 0, true, "2", "", ""));
            dicItems.Add(CreateDicItem("OrgType", "Middle", "初中", 0, true, "2", "", ""));
            dicItems.Add(CreateDicItem("OrgType", "High", "高中", 0, true, "2", "", ""));
            dicItems.Add(CreateDicItem("OrgType", "MiddleHigh", "完中", 0, true, "2", "", ""));
            //dicItems.Add(CreateDicItem("OrgType", "Class", "班级", 0, true, "3", "", ""));

            #endregion

            #region 用户类型

            //用户类型
            dicTypes.Add(CreateDicType("UserType", true, true, "用户类型"));
            //用户类型项
            dicItems.Add(CreateDicItem("UserType", "teacher", "教师", 0, true, "0", "", ""));
            dicItems.Add(CreateDicItem("UserType", "leader", "领导", 1, true, "0", "", ""));
            dicItems.Add(CreateDicItem("UserType", "student", "学生", 2, true, "1", "", ""));
            dicItems.Add(CreateDicItem("UserType", "parent", "家长)", 3, true, "2", "", ""));

            #endregion

            #region 主机类型

            //主机类型
            dicTypes.Add(CreateDicType("HostType", true, true, "主机类型"));
            //主机类型项 弱化录播型号！
            dicItems.Add(CreateDicItem("HostType", "server", "服务器", 0, true, "", "", "媒体服务器等描述"));
            dicItems.Add(CreateDicItem("HostType", "broadcast", "录播", 1, true, "", "", "Jp100，d2000等的描述"));
            //JP100B、JP100B+、JP100HD、JP100HD II、M2000、D2000、D2100
            //DicItems.Add(CreateDicItem("HostType", "broadcast_jp100", "录播(jp100)", 1, true, "broadcast", "", "Jp100"));
            //DicItems.Add(CreateDicItem("HostType", "broadcast_jp100HD", "录播(jp100HD)", 2, true, "broadcast", "", "Jp100HD"));
            //...???

            #endregion

            #region 服务类型

            //服务类型
            dicTypes.Add(CreateDicType("ServiceType", false, true, "服务类型"));
            //FtpService, EncodeService, StoreService！
            dicItems.Add(CreateDicItem("ServiceType", "FtpService", "上传", 0, true, "", "", "Ftp上传服务"));
            dicItems.Add(CreateDicItem("ServiceType", "EncodeService", "转码", 0, true, "", "", "提供视频压缩转码服务"));
            dicItems.Add(CreateDicItem("ServiceType", "StoreService", "存储", 0, true, "", "", "提供文件存储，视频点播服务"));

            #endregion

            #region 职位，职称

            dicTypes.Add(CreateDicType("Position", false, true, "职称"));
            //职位，职称
            //正高级教师    高级教师    一级教师    二级教师    三级教师
            dicItems.Add(CreateDicItem("Position", "Position1", "正高级教师(专家)", 0, true, "", "", ""));
            dicItems.Add(CreateDicItem("Position", "Position2", "高级教师", 0, true, "", "", ""));
            dicItems.Add(CreateDicItem("Position", "Position3", "一级教师", 0, true, "", "", ""));
            dicItems.Add(CreateDicItem("Position", "Position4", "二级教师", 0, true, "", "", ""));
            dicItems.Add(CreateDicItem("Position", "Position5", "三级教师", 0, true, "", "", ""));

            #endregion

            #region 任教学段

            dicTypes.Add(CreateDicType("Phase", false, true, "学段"));
            //任教学段
            dicItems.Add(CreateDicItem("Phase", "Phase1", "小学", 0, true, "", "", ""));
            dicItems.Add(CreateDicItem("Phase", "Phase2", "初中", 0, true, "", "", ""));
            dicItems.Add(CreateDicItem("Phase", "Phase3", "高中", 0, true, "", "", ""));

            #endregion

            #region 资源分类

            dicTypes.Add(CreateDicType("ResourceType", false, true, "资源分类"));
            //资源分类
            //备课    教案    试题
            dicItems.Add(CreateDicItem("ResourceType", "ResourceType1", "备课", 0, true, "", "", ""));
            dicItems.Add(CreateDicItem("ResourceType", "ResourceType2", "教案", 0, true, "", "", ""));
            dicItems.Add(CreateDicItem("ResourceType", "ResourceType3", "试题", 0, true, "", "", ""));

            #endregion

        }

        public static IList<DicType> GetDicTypes()
        {
            return dicTypes.OrderBy(x => x.SortNum).ToList();
        }
        public static IList<DicItem> GetDicItems()
        {
            return dicItems.OrderBy(x => x.SortNum).ToList();
        }

        private static DicType CreateDicType(string code, bool canEdit, bool inUse, string name)
        {
            DicType dicType = new DicType()
            {
                Code = code,
                CanEdit = canEdit,
                InUse = inUse,
                Name = name
            };
            return dicType;
        }
        private static DicItem CreateDicItem(string dicTypeCode, string code, string name, double sortNum
            , bool inUse, string subCategory, string tags, string description)
        {
            DicItem dicItem = new DicItem()
            {
                Code = code,
                Name = name,
                SortNum = sortNum,
                InUse = inUse,
                SubCategory = subCategory,
                Tags = tags,
                Description = description,
                DicTypeCode = dicTypeCode
            };

            return dicItem;
        }
    }
}
